import Vue from 'vue';
import Router from 'vue-router';
import hook from './router-hook';

const Login = () => import('@/views/login/login.vue');
const Home = () => import('@/views/home/index.vue');
const Layout = () => import('@/views/layout');
const Tinymce = () => import('@/views/rich-text/tinymce.vue');
const mdToHtml = () => import('@/views/markdown/md-to-html.vue');
const ListBlog = () => import('@/views/blog/list-blog.vue');
const XinxinHomeList = () =>
    import('@/views/xinxin-image-article/home-list.vue');
const MiniAutoRelease = () => import('@/views/mini-auto-release/list.vue');

Vue.use(Router);
const router = new Router({
    routes: [
        {
            path: '/',
            name: '',
            component: Layout,
            meta: {
                name: 'HOME',
                icon: 'home'
            },
            children: [
                {
                    path: '',
                    name: 'Home',
                    component: Home,
                    meta: {
                        name: '主页'
                    },
                    hide: true
                }
            ]
        },
        {
            path: '/blog',
            name: 'layout',
            component: Layout,
            meta: { name: '博客', icon: 'blog' },
            children: [
                {
                    path: 'list',
                    name: 'edit-blog',
                    component: ListBlog,
                    meta: { name: '文章列表' }
                }
            ]
        },
        {
            path: '/xinxin',
            name: 'layout',
            component: Layout,
            meta: { name: '欣欣图文', icon: 'info-capture' },
            children: [
                {
                    path: '',
                    name: 'xinxinHomeList',
                    component: XinxinHomeList,
                    meta: { name: '列表' }
                }
            ]
        },
        {
            path: '/mini-auto-release',
            name: 'layout',
            component: Layout,
            meta: { name: '小程序发布', icon: 'release' },
            children: [
                {
                    path: '',
                    name: 'mini-auto-release',
                    component: MiniAutoRelease,
                    meta: { name: '列表', icon: '' }
                }
            ]
        },
        /**
         * 登录
         */
        {
            path: '/login',
            name: 'login',
            component: Login,
            meta: {
                name: '登录',
                icon: 'example'
            },
            hide: true
        },
        /**
         * 富文本
         */
        {
            path: '/rich-text',
            name: '',
            component: Layout,
            meta: {
                name: '富文本',
                icon: 'rich-text'
            },
            children: [
                {
                    path: 'tinymce',
                    name: 'tinymce',
                    component: Tinymce,
                    meta: {
                        name: 'Tinymce'
                    },
                    hide: false
                }
            ]
        },
        /**
         * markdown
         */
        {
            path: '/markdown',
            name: '',
            component: Layout,
            meta: {
                name: 'markdown',
                icon: 'markdown'
            },
            children: [
                {
                    path: '',
                    name: 'mdToHtml',
                    component: mdToHtml,
                    meta: {
                        name: 'markdown转html'
                    },
                    hide: false
                }
            ]
        }
    ]
});
hook(router);
export default router;
